import BaseApi from '@/api/baseApi';
import Menu from '@/structure/menu';

/**
 * 菜单
 */
class MenuApi extends BaseApi<Menu> {
  public getBase(): string {
    return 'user/user/menu';
  }

  public getIdFieldName(): string {
    return 'menuId';
  }

  /**
   * 获取菜单树
   * @return 菜单树
   */
  public tree(): Promise<Menu[]> {
    return super.get0(`${this.getBase()}/tree`);
  }
}

export default new MenuApi();

